<?php
//require_once("logincheck.php");
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="pragma" content="no-cache">
    <title>Course</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<?php
include("db.php");
?>
<body role="document">
<div class="container">

    <?php

    echo '<div class="col-sm-8">';
    echo '<div class="page-header" id="mysql">';
    echo '    <h3>PLF企业自提保护情况 - 全球自有品牌产品亚洲展-2020</h3>';
    echo '</div>';
    echo '<table class="table table-striped">';
    echo "<thead>";
    echo "  <tr>";
    echo "    <th>#</th>";
    echo "    <th>账户名</th>";
    echo "    <th>业务员</th>";
    echo "    <th>操作时间</th>";
    echo "    <th>公司名称</th>";
    echo "  </tr>";
    echo "</thead>";
    echo '<tbody>';
    // MySQL
    $DB = DB_MySQL::getIntance();
    //$DB = new DB_MySQL;
    //$DB = DB_MySQL::getIntance();
    //$sql = "select a.account account,a.realname realname,from_unixtime(l.create_time) create_time,c.company_name company_name,l.content content,e.title title ";
    //$sql .= " from crm_company_log l,crm_exhibition e, crm_admin a,crm_zh_20200528plf_2020 c ";
    //$sql .= " where l.exhibition_id=35 and l.operator_id=a.id and l.exhibition_id=e.id and l.company_id=c.id and (l.content like '%保护' or l.content like '%退回公海') ";
    //$sql .= " order by a.account,c.company_name,l.create_time; ";
    $sql = " select a.account account,a.realname realname,from_unixtime(c.update_time) create_time,c.company_name company_name ";
    $sql .= " from crm_admin a,crm_zh_20200528plf_2020 c where c.member_id > 0  and c.member_id=a.id order by c.update_time,a.account,c.company_name;";

    //$sql = " select a.account account,a.realname realname,from_unixtime(l.create_time) create_time,c.company_name company_name ";
    //$sql .= " from crm_company_log l,crm_admin a,crm_zh_20200528plf_2020 c ";
    //$sql .= " where l.exhibition_id=35 and l.operator_id=a.id and l.company_id=c.id and c.member_id > 0  and c.member_id=a.id and l.content like '%保护' ";
    //$sql .= " order by a.account,l.create_time,c.company_name;";

    $DB->query($sql);
    $res = $DB->getAll($sql);
    $rows_count=count($res);
    for($i=0;$i<$rows_count;$i++)
    {
        //echo $res[$i]['PHONENUMBER']."  ".$res[$i]['RECEIVETIME'];
        //echo "<br>";
        echo '  <tr class="small text-nowrap">';
        echo '    <td>'.($i+1).'</td>';
        echo '    <td>'.$res[$i]['account'].'</td>';
        echo '    <td>'.$res[$i]['realname'].'</td>';
        echo '    <td>'.$res[$i]['create_time'].'</td>';
        echo '    <td>'.$res[$i]['company_name'].'</td>';
        echo "  </tr>";
    }

    echo '</tbody>';
    echo '</table>';
    echo '</div>';

    ?>

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script type="text/javascript" src="js/jquery.min.js" charset="UTF-8"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-datetimepicker.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript" src="js/bootstrap3-validation.js"></script>

<script type="text/javascript">
    $('.form_datetime').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });
    $(function(){
        //1. 简单写法：
        $("form").validation();
        $("button[type='submit']").on('click',function(event){
            // 2.最后要调用 valid()方法。
            if ($("form").valid()==false){
                $("#error-text").text("error!");
                return false;
            }
        })  })
</script>
</body>
</html>